package com.example.mydesignmodule;

import android.app.Dialog;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;


public class HomeDialog extends Dialog {

//    public HomeDialog(@NonNull Context context) {
//        super(context);
//    }

    public HomeDialog(@NonNull Context context) {
        super(context,R.style.sharemall_MyDialog);




//       getWindow().setBackgroundDrawableResource(android.R.color.transparent);
       setContentView(R.layout.sharemall_dialog_home);

        ImageView cancelImage = findViewById(R.id.iv_cancel);
        ImageView ivContent = findViewById(R.id.iv_content);
        ivContent.setImageResource(R.mipmap.aa);
    }

    public static class Builder {
        private Context context;
        private boolean isCancelable = false;
        private boolean isCancelOutside = false;

        public Builder(Context context) {
            this.context = context;
        }

        /**
         * 设置是否可以按返回键取消
         *
         * @param isCancelable
         * @return
         */

        public Builder setCancelable(boolean isCancelable) {
            this.isCancelable = isCancelable;
            return this;
        }



        /**
         * 设置是否可以取消
         *
         * @param isCancelOutside
         * @return
         */
        public Builder setCancelOutside(boolean isCancelOutside) {
            this.isCancelOutside = isCancelOutside;
            return this;
        }

//        public HomeDialog create() {
//            LayoutInflater inflater = LayoutInflater.from(context);
//            View view = inflater.inflate(R.layout.sharemall_dialog_home, null);
//            final HomeDialog homeDialog = new HomeDialog(context, R.style.sharemall_MyDialog);
//            ImageView cancelImage = view.findViewById(R.id.iv_cancel);
//            ImageView ivContent = view.findViewById(R.id.iv_content);
//            ivContent.setImageResource(R.mipmap.aa);
//
//
//            homeDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
//            homeDialog.setContentView(view);
//            homeDialog.setCancelable(isCancelable);
//            homeDialog.setCanceledOnTouchOutside(isCancelOutside);
//
//            return homeDialog;
//
//        }
    }
}
